home *** CD-ROM | disk | FTP | other *** search
- Path: prodigy.com!usenet
- From: ERQK75A@prodigy.com (Joe Larson)
- Newsgroups: comp.lang.c
- Subject: Re: A real basic problem?: (code!) long integers or compiler problem?
- Date: 20 Apr 1996 02:37:40 GMT
- Organization: Prodigy Services Company 1-800-PRODIGY
- Distribution: world
- Message-ID: <4l9ilk$12o6@useneta1.news.prodigy.com>
- References: <4l3mom$f26@newsbf02.news.aol.com> <4l699u$cgo@newsbf02.news.aol.com> <4l70g7$m7i@ccshst05.uoguelph.ca>
- NNTP-Posting-Host: innugap5-int.news.prodigy.com
- X-Newsreader: Version 1.2
-
- I think you're right, Toby - except it'll take about 65,535 times longer,
- and not quite as a long as a day or 2...!
-
- I compiled the program with Borland C++ 4.5 and had no problem running it
- on a Pentium90 - but I had to wait a little while. I inserted timestamps
- around maxlng() to see that it took 269 secs. For a 486DX2(-66?) it'll
- take about twice as long. Check it out.
-
- #include <stdio.h>
- #include <time.h>
-
- void main()
- {
- long i;
- long maxlng();
- time_t st, et;
-
- time(&st);
- i=maxlng();
- time(&et);
- printf("max i= %ld, max i+1= %ld",i,i+1);
- printf("\nSecs = %ld.", et-st);
- }
-
- long maxlng()
- {
- long first, b;
- first = 10000;
- while (first >= 0)
- {
- b= first;
- first++;
- }
- return (b);
- }
-
-
-